@echo off
if "%1" == "" (
    set rootDir=ohosmain
) else (
    set rootDir=%1
)
set user=z00622034
set host=123.60.8.121
set port=26389
set srcPath=/user5/z00622034/Program/%rootDir%/code/out/sdk/mingw_x86_64/common/common
@REM set user=zhangyu
@REM set host=124.221.254.142
@REM set port=22
@REM set srcPath=/home/zhangyu/Program/%rootDir%/code/out/sdk/mingw_x86_64/common/common
set dstPath=D:\WorkDir\Previewer\previewer
set ftpFile=C:\Users\zhangyu\GlobalFiles\Scripts\sftp.txt

echo Delete all files about the previewer.
if exist %dstPath% (
    rmdir /q/s %dstPath%
)

echo Download all files about the previewer.
echo The source path is: "%srcPath%".
echo The destination path is: "%dstPath%".
>%ftpFile% (
    echo get -r %srcPath% %dstPath%
    echo bye
)
sftp -b %ftpFile% -oPort=%port% %user%@%host%
del %ftpFile%